//
//  PackingOperator.m
//  CJRailTransport
//
//  Created by Hank on 2017/11/24.
//  Copyright © 2017年 amplity. All rights reserved.
//

#import "PackingOperator.h"
#define kAPISubPath @"cetmsplat"

@implementation PackingOperator

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setHostWithPath:kAPISubPath];
    }
    return self;
}

// 获取列车方向
- (void)postDictItem:(NSDictionary *)info tag:(id)tag successBlock:(succeedBlock)successBlock failureBlock:(failureBlock)failureBlock
{
    NSString *url = [self getUrlWithMethod:@"dict/getDictItem"];
    
    DataVisitor *visitor = [[DataVisitor alloc] init];
    [visitor executePOSTWithUrl:url Params:info tag:tag successBlock:^(id respondObject) {
        if (successBlock) {
            //返回 codes 解析
            NSNumber *responseCode = [respondObject objectForKey:@"retcode"];
            if (responseCode.intValue == 1) {
                successBlock(respondObject);
            }else{
                failureBlock(respondObject);
            }
        }
    } failureBlock:^(id respondObject) {
        failureBlock(respondObject);
    }];
}

@end
